<script type="text/javascript" src="module/mod_desa/js/combo.js"></script>

<div id="tiga_ba">
	<div id="tiga_baa">Ubah Data Desa</div>
	<div id="tiga_bab"></div>
	<div class="clear"></div>
</div>
            
<?php
	$id=$_GET['id'];
	$sql="select d.id_desa, d.desa, d.id_kecamatan, c.id_kabupaten, k.id_propinsi from desa d inner join kecamatan c on d.id_kecamatan = c.id_kecamatan inner join kabupaten k on c.id_kabupaten = k.id_kabupaten inner join propinsi p on k.id_propinsi = p.id_propinsi where d.id_desa = $id";
	$qry=mysql_query($sql);
	$hasil=mysql_fetch_array($qry);
?>
<form action="utama.php?module=mod_desa&act=update" onsubmit="return gsValidate('desa|kabupaten|kecamatan','Nama Desa Harus Diisi|Nama Kabupaten Harus Dipilih|Nama Kecamatan Harus Dipilih','required|required|required');" method="post" enctype="multipart/form-data">
	<table style="margin: 10px 15px 10px 15px;">
		<tr>
			<td>Kode Desa</td>
			<td>&nbsp;</td>
			<td><input name="kode" type="text" id="kode" value="<?php echo $hasil['id_desa']?>" class="input_small" disabled/></td>
		</tr>
		<tr>
			<td>Nama Desa</td>
			<td>&nbsp;</td>
			<td>
				<input name="desa" type="text" class="input2" id="desa" maxlength="50" value="<?php echo $hasil['desa']?>"/>
				<input name="id_desa" type="hidden" id="id_desa" value="<?php echo $hasil['id_desa']?>" />
				<span class="red">*</span>
			</td>
		</tr>
		<tr>
			<td>Provinsi</td>
			<td>&nbsp;</td>
			<td>
				<select name="provinsi" id="provinsi" class="input2">
					<?php
						$provinsi = mysql_query("select * from propinsi where aktif = 'Y' order by propinsi");
						while($p = mysql_fetch_array($provinsi)){
							if($p['id_propinsi'] == $hasil['id_propinsi']){
								$s = "selected";
							}else{
								$s = "";
							}
							echo "<option value='$p[id_propinsi]' $s>$p[propinsi]</option>";
						}
					?>
				</select>
			</td>
		</tr>
		<tr>
			<td>Kabupaten</td>
			<td>&nbsp;</td>
			<td>
				<select name="kabupaten" id="kabupaten" class="input2">
					<?php
						$kabupaten = mysql_query("select * from kabupaten k inner join propinsi p where k.id_propinsi = $hasil[id_propinsi] and k.aktif = 'Y' and p.aktif = 'Y' order by k.kabupaten");
						while($k = mysql_fetch_array($kabupaten)){
							if($k['id_kabupaten'] == $hasil['id_kabupaten']){
								$sk = "selected";
							}else{
								$sk = "";
							}
							echo "<option value='$k[id_kabupaten]' $sk>$k[kabupaten]</option>";
						}
					?>
				</select>
				<span class="red">*</span>
			</td>
		</tr>
		<tr>
			<td>Kecamatan</td>
			<td>&nbsp;</td>
			<td>
				<select name="kecamatan" id="kecamatan" class="input2">
					<?php
						$kecamatan = mysql_query("select * from kecamatan where id_kabupaten = $hasil[id_kabupaten] order by kecamatan");
						while($kc = mysql_fetch_array($kecamatan)){
							if($kc['id_kecamatan'] == $hasil['id_kecamatan']){
								$sk = "selected";
							}else{
								$sk = "";
							}
							echo "<option value='$kc[id_kecamatan]' $sk>$kc[kecamatan]</option>";
						}
					?>
				</select>
				<span class="red">*</span>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td>&nbsp;</td>
			<td><input name="submit" type="submit" class="button" value="Ubah" /></td>
		</tr>
	</table>
</form>		
            
        